<template>
  <div>
    <VisitInformation
      :list="list"
      @xiangqing="xiangqing"
    ></VisitInformation>
    <PatientDetaile 
    @xiangqing="xiangqing"
    :obj="obj"
    :flag="flag"
    @close="close"
    > </PatientDetaile>
  </div>
</template>
<script>
// import 组件名 from '需要引入组件的路径'（@/是在src文件夹下找  ./ 是在全局下找）
import VisitInformation from "@/components/VisitInformation.vue";
import PatientDetaile from "@/components/PatientDetails.vue";
export default {
  // 需要处理的数据
  data() {
    return {
      list: [
        {
          id: 1,
          shiJian: "2022-01-01",
          yiSheng: "张十三",
          bingQin: "健康",
          chufang: "多喝热水",
          caozou: "详情",
        },
        {
          id: 2,
          shiJian: "2022-01-01",
          yiSheng: "张十四",
          bingQin: "健康",
          chufang: "多喝热水",
          caozou: "详情",
        },
        {
          id: 3,
          shiJian: "2022-01-01",
          yiSheng: "张五一",
          bingQin: "健康",
          chufang: "多喝热水",
          caozou: "详情",
        },
        {
          id: 4,
          shiJian: "2022-01-01",
          yiSheng: "张六一",
          bingQin: "健康",
          chufang: "多喝热水",
          caozou: "详情",
        },
        {
          id: 5,
          shiJian: "2022-01-01",
          yiSheng: "张十一",
          bingQin: "健康",
          chufang: "多喝热水",
          caozou: "详情",
        },
      ],
      obj:{},
      flag:false,
    };
  },
  // 注册组件
  components: {
    // 注册表格组件
    VisitInformation,
    PatientDetaile,
  },
  // 方法属性
  methods: {
    // 接受子组件传递过来的数据
    xiangqing(e){
       this.flag=!this.flag
        this.obj= this.list.find(item=>item.id ===e);
    },
    close(flag){
      this.flag = !flag
    }
  },
};
</script>
<style scoped>
</style>
